{template 'header'}
<style>
input[type="textarea"] {
height: 60px;
}
</style>

<link type="text/css" rel="stylesheet" href="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/cw_weijiajiao/template/css/online_booking.css">
<link rel="stylesheet" type="text/css" href="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/cw_weijiajiao/template/css/common.css" media="all">
<link rel="stylesheet" type="text/css" href="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/cw_weijiajiao/template/css/pig-ui.css" media="all">

   
    <ul class="round">

        <div class="">
            <ul class="round">
                <li class="title mb">
                    <span class="none">请认真填写在线预约信息！</span>
                </li>
                <li class="nob" id="namea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>教师照片</th>
                                <td><img src="{$_W['attachurl']}{$info_picurl}" alt="" style="width:100%;height:400px;" /></td>
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="nob" id="diseasea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>被预约教师姓名</th>
                                <td>
                                    <input name="tecname" type="text" class="px" id="tecname" readonly="true" data-prompt-position="bottomLeft" value="{$project['tecname']}"></td> 
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="nob" id="diseasea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>教授课程</th>
                                <td>
                                    <input name="teclesson" type="text" class="px" id="teclesson" readonly="true" data-prompt-position="bottomLeft" value="{$project['teclesson']}"></td>  
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="nob" id="diseasea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>教师简介</th>
                                <td>
                                    <textarea style="height:100px;" name="teccontent" id="teccontent"cols="73" readonly="true">{$project['teccontent']}</textarea>  
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </li> 
                <li class="nob" id="namea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>预约学生姓名</th>
                                <td>
                                    <input name="truename" type="text" class="px" id="truename" value="" placeholder="请输入真实姓名" data-validation-engine="validate[required,minSize[2],maxSize[8]]" data-errormessage-value-missing="必填项" data-prompt-position="bottomLeft"></td>
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="nob" id="namea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>预约学生身份证</th>
                                <td>
                                    <input name="idno" type="text" class="px" id="idno" value="" placeholder="请输入身份证号码" data-validation-engine="validate[required,minSize[18],maxSize[18]]" data-errormessage-value-missing="必填项" data-prompt-position="bottomLeft"></td>
                            </tr>
                        </tbody>
                    </table>
                </li>				
                <li class="nob" id="namea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>预约学生性别</th>
                                 <td>
                                     <label class="radio-inline"><input type="radio" name="sex" id="sex" class="answer2" value="0" {if empty($item) || $item['sex']=='0'}checked{/if} />男</label> &nbsp;&nbsp;&nbsp;
                                     <label class="radio-inline"><input type="radio" name="sex" id="sex" class="answer2" value="1" {if $item['sex']=='1'}checked{/if} />女</label> 
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="nob" id="phonea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>家长手机</th>
                                <td>
                                    <input name="mobile" type="text" class="px" id="mobile" value="" placeholder="请输入您的手机" data-validation-engine="validate[required,minSize[11],maxSize[11]]" data-errormessage-value-missing="必填项" data-prompt-position="bottomLeft"></td>
                            </tr>
                        </tbody>
                    </table>
                </li>
                
			
                				
                <li class="nob" id="diseasea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>预约时间</th>
                                <td>
                                    <input name="restime" type="text" class="px" id="restime" value="" placeholder="请填写预约时间！"></td>
                            </tr>
                        </tbody>
                    </table>
                </li>

                <li class="nob" id="diseasea">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                        <tbody>
                            <tr>
                                <th>备注</th>
                                <td>
                                    <input name="info" type="text" class="px" id="info" value="" placeholder="以上如有不足或有其它要求，请在此填写！"></td>
                            </tr>
                        </tbody>
                    </table>
                </li>
                <li class="title mb">
<p>网上预约注意事项</p>
<p>1、预约登记时请您提供真实姓名及有效的联系电话，方便预约确认。</p>
<p>2、预约日期格式：年+月+日（上午或者下午）。</p>
<p>3、预约教师临时有事，我们将及时电话（短信）告知您。</p>
<p>（最终解释权归本机构）</p>
                </li> 
            </ul>

        </div>

    </ul>
    <div class="footReturn">
        <input id="showcard" class="submit" value="提交预约" type="button" style="width: 100%;cursor: pointer;">    
        <div class="window" id="windowcenter">
            <div id="title" class="wtitle">
                操作提示
                <span class="close" id="alertclose"></span>
            </div>
            <div class="content">
                <div id="txt"></div>
            </div>
        </div>
    </div>

<script type="text/javascript">

$("#showcard").bind("click",
function() {

    var btn = $(this);
    var truename    = $("#truename").val();
    var mobile      = $("#mobile").val();
    var idno      = $("#idno").val();	
    var info        = $("#info").val();
    var tecname   = "{$project['tecname']}";
    var department_id   = "{$project['department_id']}";
    var tecid       = "{$project['id']}";
	var sex        = $("input[name='sex']:checked").val();
	var restime    = $("#restime").val();

	if (sex == undefined) {
        alert("请选择性别");
        return
    }	
    //var portrait       = $("#portrait").val();
    if (mobile == '') {
        alert("请认真输入手机号");
        return
    }
    reg=/^(13[0-9]|14[0-9]|15[0-9]|18[0-9])\d{8}$/;
    if(!reg.test(mobile)){
		alert("请输正确手机号！");
		return;
    }
	 
    if (truename == '') {
        alert("请输入真实姓名");
        return
    }
	
    if (idno == '') {
        alert("请输入身份证号");
        return
    }	
    reg=/^\d{15}|\d{}18$/;
    if(!reg.test(idno)){
		alert("请输入正确身份证号！");
		return;
    }

    // if(wecha_id == ''){
    //   alert("您可能没有关注我们的微信号,因此不能提交信息.请关注后再来.");
    //   return;
    // }

    var submitData = {
        truename  : truename,
        mobile    : mobile,
        tecid      : tecid,
        tecname  : tecname,
        department_id : department_id,
        info      : info,
		idno       : idno,
		sex        : sex,
		restime    : restime			
    };
    $.post("{php echo $this->createMobileUrl('yysave')}", submitData,
    function(data) {
        if(1==data.errno){

            //setTimeout("window.location.href = location.href",2000);
            alert('预约单已提交！');
            location.href = data.url;
        }else if(2 == data.errno){
            alert('提交信息不对,请重新输入,或者联系我们');
        }else if(3 == data.errno){
            alert(data.msg);
            location.href = data.url;
        }else{
          alert("非常抱歉,请重新打开此页面.");
        }
    },
    "json")
});

</script>

{template 'footer'}
